<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8"/>
  <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>Document</title>
</head>
<body>
<div id="app">
  <h2>{{ msg }}</h2>
  <div @click="divClick">
<!--    .stop阻止冒泡的修饰符，只会执行当前时间，不会往上传-->
    <button @click.stop="btnClick">please</button>
    <br>
    <form action="baidu">
      <!--    .present 阻止默认的时间触发,这里会把submit的默认事件阻止-->
      <input type="submit"value="upload" @click.prevent.stop="submitClick">
    </form>
<!--    监听键盘某个键位的触发,常用.enter 监听回车键-->
    <input type="text" @keyup.enter="keyup()">

    <br>
<!--    once修饰符，指出发一次事件-->
    <button @click.stop.once="onceBtn">once</button>
  </div>
</div>
<script src="../node_modules/vue/dist/vue.js"></script>
<script>
  new Vue({
    el: "#app",
    data: {
      msg: "hello,world",
    },
    methods:{
      divClick(){
        console.log("divClick")
      },
      btnClick(){
        console.log("btnClick")
      },
      submitClick(){
        console.log("submitClick")
      },
      keyup(){
        console.log("keyup")
      },
      onceBtn(){
        console.log("onceBtn")
      }
    }
  });
</script>
</body>
</html>
